import axios from 'axios';
import { config } from '../config';

export async function get(url: string): Promise<string> {
    try {
        const response = await axios.get(url, { 
            headers: config.request.headers,
            timeout: config.request.timeout
        });
        return response.data as string;
    } catch (error) {
        console.error(`请求失败: ${url}`, error);
        throw error;
    }
}

export function delay(ms: number): Promise<void> {
    return new Promise(resolve => setTimeout(resolve, ms));
}